package com.lancoo.znbkxx.teacher.diagnosis

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.CompositePageTransformer
import androidx.viewpager2.widget.MarginPageTransformer
import com.lancoo.znbkxx.teacher.R
import com.lancoo.znbkxx.teacher.base.BaseActivity
import com.lancoo.znbkxx.teacher.utils.DensityUtils
import com.lancoo.znbkxx.teacher.utils.ScaleInTransformer
import kotlinx.android.synthetic.main.activity_unstudyvocab_list.*

/**
 *@author Admin
 *@date 2021/1/4
 *
 */
class UnStudyTopicListActivity : BaseActivity(){
    private val zsdArea by lazy { intent.getStringExtra("zsd") }
    private val stuID by lazy { intent.getStringExtra("stuID") }
    override fun setLayout(): Int {
        return R.layout.activity_unstudyvocab_list
    }

    override fun initView() {
        tv_title.text="未学习语法"
        iv_back.setOnClickListener { finish() }
        vp_vocab.offscreenPageLimit = 1
        vp_vocab.adapter = object : FragmentStateAdapter(supportFragmentManager, lifecycle) {
            override fun getItemCount(): Int {
                return 3
            }

            override fun createFragment(position: Int): Fragment {
                return UnStudyTopicListFragment().apply {
                    arguments = Bundle().apply {
                        putInt("type", position)
                        putString("zsd", zsdArea)
                        putString("stuID",stuID)
                    }
                }
            }
        }
        val transformer = CompositePageTransformer()
        transformer.addTransformer(MarginPageTransformer(DensityUtils.dp2px(this, 9f)))
        transformer.addTransformer(ScaleInTransformer())
        vp_vocab.setPageTransformer(transformer)
    }

    override fun isNeedToolBar(): Boolean {
        return false
    }
}